#include "login.h"

Login::Login(QWidget *parent) :
    QDialog(parent)
{
    this->setWindowTitle("Login");
    this->setMinimumSize(400,300);
    this->setMaximumSize(400,300);

    WelcomLabel =new QLabel;
    LoginIDLabel = new QLabel;
    PswLabel = new QLabel;
    ID = new QLineEdit;
    PSW = new QLineEdit;
    LoginBtn = new QPushButton;
    ExitBtn = new QPushButton;

    //欢迎语设置
    WelcomLabel->setText("Welcome to YYZ's Video System");
    //WelcomLabel->setSizeIncrement(50,100);
    WelcomLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
    LoginIDLabel->setText("ID:");
    PswLabel->setText("PSW:");
    LoginBtn->setText("LogIn");
    ExitBtn->setText("Exit");



    Textlayout = new QVBoxLayout;
    Editlayout = new QVBoxLayout;
    Btnlayout = new QHBoxLayout;
    TElayout = new QHBoxLayout;
    ALLlayout = new QVBoxLayout;

    Textlayout->addWidget(LoginIDLabel);
    Textlayout->addWidget(PswLabel);
    Editlayout->addWidget(ID);
    Editlayout->addWidget(PSW);
    Btnlayout->addWidget(LoginBtn);
    Btnlayout->addWidget(ExitBtn);
    TElayout->addLayout(Textlayout);
    TElayout->addLayout(Editlayout);
    ALLlayout->addWidget(WelcomLabel);
    ALLlayout->addLayout(TElayout);
    ALLlayout->addLayout(Btnlayout);

    this->setLayout(ALLlayout);

    connect(ExitBtn,SIGNAL(clicked()),this,SLOT(close()));

    connect(LoginBtn,SIGNAL(clicked()),this,SLOT(HideLogin()));

}

void Login::HideLogin()
{
    this->hide();
    emit showmain();
}
